package com.polaris.server.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.polaris.server.pojo.SysRole;
import com.polaris.server.mapper.SysRoleMapper;
import com.polaris.server.service.ISysRoleService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author polaris
 * @since 2021-06-02
 */
@Service
public class SysRoleServiceImpl extends ServiceImpl<SysRoleMapper, SysRole> implements ISysRoleService {

    private final SysRoleMapper roleMapper;

    public SysRoleServiceImpl(SysRoleMapper roleMapper) {
        this.roleMapper = roleMapper;
    }

    /**
     * 通过id查询role
     * @param roleId
     * @return
     */
    @Override
    public SysRole getRoleByRoleId(Long roleId) {
        return roleMapper.selectOne(new QueryWrapper<SysRole>().eq("roleId",roleId));
    }
}
